package control;

import java.sql.SQLException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import model.UsuarioCT;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import dao.UsuarioProjetoDAO;

public class AssociaProjetoAction extends Action {
	
	public ActionForward execute(ActionMapping map, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws SQLException {
		
		//Dados do JSP
		HttpSession session = request.getSession();
		UsuarioCT usuario = (UsuarioCT)session.getAttribute("usuario");
		String nomeUnix = request.getParameter("nomeUnix");
		String tipo = request.getParameter("tipo");
		
		Facade facade = Facade.getInstance();
		facade.associaProjeto(usuario.getUsuario(), nomeUnix, tipo);
		
		return map.findForward("requisicao_enviada");
	}
}